package net.perretxiko.dao;

import java.util.ArrayList;
import java.util.List;

import net.perretxiko.form.Batu;
import net.perretxiko.form.Erabiltzaile;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;


@Transactional
@Repository
public class BatuDAOMySQLImpl implements BatuDAO{
	
	@Autowired
	private SessionFactory sessionFactory;

	@Transactional
	public void addPerretxikoak(Batu batu) {
		sessionFactory.getCurrentSession().save(batu);
		
	}

	@Transactional
	public List<Batu> GetZesta(int idZesta) {
		List<Batu> usr = sessionFactory.getCurrentSession().find("from Batu where IDZESTA = '"+idZesta+"'");
		
		if (usr.size()>0) {
			return usr;
	    } else {
	    	return null;
		}
	}
	

}
